#pre-requisites
source "$METIS_HOME"metis-plugin.config

_pluginName=`basename $0 | sed -r 's/.sh$//'`
_pluginOutputDirectory="${pluginDir}${_pluginName}/"
mkdir ${_pluginOutputDirectory}

if [ -n "$1" ]; then
	timeout="$1"
else
	timeout=1800
fi
threads=5

query='select ipaddress,port from services where service = "microsoft-rdp" and state = "open" and protocol = "tcp"'
cmd="${m_ncrack} \${1}:\${2},CL=2 -vvv --user=administrator --pass=${m_pass_wordlist_win} &> ${_pluginOutputDirectory}\${1}_\${2}.rdpbrute"

"$pythonInterpreter" "$q2ex" -d "$database" -q "$query" -c "$cmd" -t "$threads" -T "$timeout" -o "$_pluginOutputDirectory" -e "$_pluginName" -L "$logginglevel" -O "$outputLog"
